import { createRouter, createWebHashHistory } from "vue-router";
import LoginRegistration from "../views/LoginRegistration.vue";
import HomeView from "../views/HomeView";
import DataReading from "../views/DataReading";
import UserManagement from "../views/UserManagement";
import ArticleManagement from "../views/ArticleManagement";
import CommentManagement from "../views/CommentManagement";
import PublishView from "../views/PublishView";
import ReviseView from "../views/ReviseView";
import ProductInformation from "../views/ProductInformation";
import TechnicalSupport from "../views/TechnicalSupport";

const routes = [
    {
        path: "/",
        name: "loginRegistration",
        component: LoginRegistration,
    },
    {
        path: "/home",
        name: "home",
        redirect: { name: "userManagement" },
        component: HomeView,
        children: [
            // 用户管理
            {
                path: "/userManagement",
                name: "userManagement",
                component: UserManagement,
            },
            // 文章管理
            {
                path: "/articleManagement",
                name: "articleManagement",
                component: ArticleManagement,
            },
            // 发布
            {
                path: "/publishView",
                name: "publishView",
                component: PublishView,
            }, // 信息编辑
            {
                path: "/revise",
                name: "revise",
                component: ReviseView,
            },
            // 评论管理
            {
                path: "/commentManagement",
                name: "commentManagement",
                component: CommentManagement,
            },
            // 数据阅览
            {
                path: "/dataReading",
                name: "dataReading",
                component: DataReading,
            },

            // 产品信息
            {
                path: "/productInformation",
                name: "productInformation",
                component: ProductInformation,
            },
            //技术支持
            {
                path: "/technicalSupport",
                name: "technicalSupport",
                component: TechnicalSupport,
            },
        ],
    },
    // {
    //     path: "/about",
    //     name: "about",
    //     // route level code-splitting
    //     // this generates a separate chunk (about.[hash].js) for this route
    //     // which is lazy-loaded when the route is visited.
    //     component: () => import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
    // },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;
